package com.ctsi.framework.mybatis.dialect;

import java.sql.PreparedStatement;
import java.sql.SQLException;
public class Fb2Dialect extends AbstractMiDialect {



	@Override
	public void setLimitParamters(PreparedStatement ps, int parameterSize, int offset, int limit) throws SQLException {
		if (offset > 0) {
			ps.setInt( 1, limit);
			ps.setInt( 2, offset);
		} else {
			ps.setInt( 1, limit);
		}

	}

	@Override
	public String getLimitString(String sql, int offset) {

		return new StringBuilder(sql.length() + 20).append(sql).insert(6, offset > 0 ? " first ? skip ?" : " first ?").toString();
	}

	@Override
	public boolean supportsLimitOffset() {

		return true;
	}
	@Override
	public boolean bindLimitParametersFirst() {
		return true;
	}

}
